// 1.引入request
import request from '@/utils/request';

import type { User } from '@/types/user';
type ResData<T> = {
  code: number;
  message: string;
  data: T;
};
export function cpLoginByPassWord(data: { password: string; mobile: string }) {
  return request.post<any, ResData<User>>('/login/password', data);
}

import type { CodeType } from '@/types/user';

export function cpGetSMSCode(params: { mobile: string; type: CodeType }) {
  return request.get<any, ResData<{ code: string }>>('/code', { params });
}

export function cpLoginByCode(data: { code: string; mobile: string }) {
  return request.post<any, ResData<User>>('/login/password', data);
}
